<?php
require('../database/db.php');
$mysql=new mysql();
$ordersid=$_REQUEST['ordersid'];
$danhao=$_REQUEST['danhao'];
$kuaidi=$_REQUEST['kuaidi'];
$fa_huo_datetime =  date("Y-m-d H:i:s");//发货时间
if ($ordersid && $danhao && $kuaidi) {
	$state = 2;
	$sql = "UPDATE goodsorders SET danhao='".$danhao."',kuaidi='".$kuaidi."',state=".$state.",fa_huo_datetime='".$fa_huo_datetime."' where ordersid=".$ordersid;
	// var_dump($sql);
	$mysql->query($sql);

	// 调用信息推送接口
	$url = "http://120.24.0.10/xzpf/api/jpush/jpush.php?state=".$state."&ordersid=".$ordersid;
	file_get_contents($url);
	// 调用信息推送接口 end
	if ($mysql->affected_rows()>0) {
		$arr = array('code' => 100, 'tip' => '添加成功');
	}else{
		$arr = array('code' => 300, 'tip' => '添加失败');
	}
}else{
	$arr = array('code' => 200, 'tip' =>'参数传入有误,必传入参数:订单id=>ordersid,快递单号=>danhao,快递公司id=>kuaidi');
}
echo json_encode($arr);
?>